<?php

namespace App\Http\Requests\BK\User;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UserIndexRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'page'=>'nullable|integer|min:1',
            'limit'=>'nullable|integer|min:1',
            'mobile'=>'nullable|numeric',
            'begin'=>'nullable|date_format:"Y-m-d H:i:s"',
            'end'=>'nullable|date_format:"Y-m-d H:i:s"',
            'status'=>['nullable',Rule::in([1,2])],
            'id'=>'nullable|integer',
        ];
    }

    public function attributes()
    {
        return [
            'page'=>'页码',
            'limit'=>'每页数量',
            'mobile'=>'手机号',
            'begin'=>'开始时间',
            'end'=>'结束时间',
            'status'=>'状态',
            'id'=>'用户id',
        ];
    }
}
